<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>

<html>
<head>
    <link rel="stylesheet" type="text/css" href="${path}/css/public.css"/>
    <link rel="stylesheet"
          href="${path}/css/themes/base/jquery.ui.all.css">
    <link rel="stylesheet" href="${path}/js/demos.css">

    <script type="text/javascript"
            src="${path}/js/jquery-1.7.2.js"></script>
    <script type="text/javascript"
            src="${path}/js/jquery.ui.core.js"></script>
    <script type="text/javascript"
            src="${path}/js/jquery.ui.widget.js"></script>
    <script type="text/javascript"
            src="${path}/js/jquery.ui.position.js"></script>
    <script type="text/javascript"
            src="${path}/js/jquery.ui.autocomplete.js"></script>
    <script type="text/javascript"
            src="${path}/js/jquery.ui.datepicker.js"></script>
    <script type="text/javascript"
            src="${path}/js/jquery.ui.datepicker-zh-CN.js"></script>
    <script src="${path}/js/jquery.ui.button.js"></script>
    <link rel="stylesheet" href="${path}/css/icons.css">
    <script src="${path}/js/icons.js"></script>


    <title>i18n.title.visitRecord.search
    </title>
</head>
<body>
<!--头部-->
<div class="header">


    <div class="top">
        <div class="top_left">
            <span class="f1">欢迎您：${user.realName}</span>
        </div>
        <div class="top_right">
            <a href="${path}/toIndex.action" class="top_ico0">首页</a>
            <a href="${path}/initUpdatePassword.action" class="top_ico1">修改密码</a>
            <a href="${path}/user/initPersonalInfo.action" class="top_ico2">个人信息</a>
            <a href="${path}/logout.action" class="top_ico3">退出</a>
        </div>
    </div>
    <div class="top2">
        <p class="pro_id">客户关系管理系统 小管版本</p>
    </div>
</div>

<!--主体-->
<table class="main" border="0"
       style="width: 100%; background-color: #FFFFFF">
    <tr>
        <td width="140" style="vertical-align: top;">
            <div class="main_left">


                <script type="text/javascript" src="${path}/js/jquery.ui.accordion.js"></script>

                <script type="text/javascript">
                    $().ready(function () {
                        $('.menuTitle').click(function () {//添加menuTitle的click事件
                            if ($(this).next().is(":hidden")) {//隐藏判断
                                $('.menu_ul_div').slideUp();//隐藏 */
                                $(this).next().slideDown();//显示
                            } else {
                                if ($(this).next().attr("id") == 'menu_ul_div_1') {

                                    $('.menu_ul_div').slideUp();//隐藏 */
                                    $('#menu_ul_div_2').slideDown();//显示

                                }
                                ;
                                if ($(this).next().attr("id") == 'menu_ul_div_2') {

                                    $('.menu_ul_div').slideUp();//隐藏 */
                                    $('#menu_ul_div_3').slideDown();//显示

                                }
                                ;
                                if ($(this).next().attr("id") == 'menu_ul_div_3') {

                                    $('.menu_ul_div').slideUp();//隐藏 */
                                    $('#menu_ul_div_4').slideDown();//显示

                                }
                                if ($(this).next().attr("id") == 'menu_ul_div_4') {

                                    $('.menu_ul_div').slideUp();//隐藏 */
                                    $('#menu_ul_div_1').slideDown();//显示

                                }
                            }
                        });
                    });
                </script>
                <div class="sidebar">

                    <h2 id="menu1" class="menuTitle">客户管理</h2>
                    <div class="menu_ul_div" id="menu_ul_div_1"
                         style="display:block;"
                    >
                        <ul id="menu1_ul" class="menu_ul">
                            <li class="menuItem"><a href="${path}/customer/initConflict.action">客户冲突</a></li>
                            <li class="menuItem"><a href="${path}/customer/initAdd.action">添加客户</a></li>
                            <li class="menuItem"><a href="${path}/customer/initServe.action">服务中签约客户</a></li>
                            <li class="menuItem"><a href="${path}/customer/initNoServe.action">未签约客户</a></li>
                            <li class="menuItem"><a href="${path}/customer/initNoServeFirst.action">未签约-已初试</a></li>
                            <li class="menuItem"><a href="${path}/customer/initNoServeSecond.action">未签约-已复试</a></li>
                            <li class="menuItem"><a href="${path}/customer/getAllSea.action">公海客户</a></li>
                            <li class="menuItem"><a href="${path}/visitRecord/initSearch">拜访查询</a></li>
                        </ul>
                    </div>


                    <h2 id="menu2" class="menuTitle">合同管理</h2>
                    <div class="menu_ul_div" id="menu_ul_div_2"

                         style="display:none;">
                        <ul id="menu2_ul" class="menu_ul">
                            <li class="menuItem"><a href="${path}/contractTemplate/initList.action">合同模版</a></li>
                            <li class="menuItem"><a href="${path}/contract/initAdd.action">新增合同</a></li>
                            <li class="menuItem"><a href="${path}/contract/initContractValid.action">有效合同查询</a></li>
                            <li class="menuItem"><a href="${path}/contract/initContractInvalid.action">无效合同查询</a></li>
                            <li class="menuItem"><a href="${path}/contract/initPaymentReceivable.action">应收款查询</a></li>
                            <li class="menuItem"><a href="${path}/contract/initPaymentReceived.action">到款查询</a></li>
                        </ul>
                    </div>


                    <h2 id="menu3" class="menuTitle">报表管理</h2>
                    <div class="menu_ul_div" id="menu_ul_div_3"

                         style="display:none;">
                        <ul id="menu3_ul" class="menu_ul">
                            <li class="menuItem"><a href="${path}/report/initReport.action">拜访量报表</a></li>
                        </ul>
                    </div>


                    <h2 id="menu4" class="menuTitle">系统设置</h2>
                    <div class="menu_ul_div" id="menu_ul_div_4"

                         style="display:none;">
                        <ul id="menu4_ul" class="menu_ul">
                            <li class="menuItem"><a href="${path}/system/search.action">员工设置</a></li>
                            <li class="menuItem"><a href="${path}/announcement/search.action">公告管理</a></li>
                            <li class="menuItem"><a href="${path}/system/elses.action">其他设置</a></li>
                        </ul>
                    </div>

                </div>
            </div>
        </td>
        <td style="vertical-align: top;">
            <div class="main_right">


                <link rel="stylesheet" href="${path}/css/themes/base/jquery.ui.all.css">
                <script src="${path}/js/jquery-1.7.2.js"></script>
                <script src="${path}/js/jquery.ui.core.js"></script>
                <script src="${path}/js/jquery.ui.widget.js"></script>
                <script src="${path}/js/jquery.ui.button.js"></script>
                <link rel="stylesheet" href="${path}/css/demos.css">

                <link rel="stylesheet" href="${path}/css/icons.css">
                <link rel="stylesheet" href="${path}/css/icons-back.css">

                <script src="${path}/js/icons.js"></script>
                <script src="${path}/js/icons-back.js"></script>

                <style type="text/css">

                    .pageBody {
                        height: 80%;
                        width: 100%;
                    }
                </style>

                <script type="text/javascript">
                    $(function () {
                        $("#chooseOwner").click(
                            function () {
                                var config = "resizable:no;center:yes;dialogWidth:300px;dialogHeight:200px;dialogTop:200px;dialogLeft:150px";
                                showModalDialog(
                                    "${path}/visitRecord/initOwnerList",
                                    document, config);
                            });
                    });
                </script>
                <script type="text/javascript">

                    function submitForm() {


                        //获取客户的拜访方式
                        var visitTypeArrs = document.getElementsByName("visitTypeArr");
                        var visitTypes = "";
                        for (var i = 0; i < visitTypeArrs.length; i++) {
                            if (visitTypeArrs[i].checked) {
                                //以:作为分隔,方便后台遍历
                                visitTypes += visitTypeArrs[i].value + ":";
                            }
                        }
                        //将值放入隐藏域中方便后台获取
                        var hiddenTypes = document.getElementById("__multiselect_search_visitTypeArr");
                        hiddenTypes.value = visitTypes;


                        //获取是否为第一次访问
                        var ifFirstVisit = document.getElementsByName("onlyFirstVisit")[0];
                        var onlyFirstVisit = false;
                        if (ifFirstVisit.checked) {
                            var onlyFirstVisit = true;
                        }
                        //将值放入隐藏域中方便后台获取
                        var hiddenFirst = document.getElementById("__checkbox_search_onlyFirstVisit");
                        hiddenFirst.value = onlyFirstVisit;

                        //获取客户等级
                        var levelArrs = document.getElementsByName("levelArr");
                        var levels = "";
                        for (var i = 0; i < levelArrs.length; i++) {
                            if (levelArrs[i].checked) {
                                //以:作为分隔,方便后台遍历
                                levels += levelArrs[i].value + ":";
                            }
                        }
                        var hiddenlevels = document.getElementById("__multiselect_search_levelArr");
                        hiddenlevels.value = levels;

                        //获取客户的状态
                        var statusArrs = document.getElementsByName("statusArr");
                        var statuss = "";
                        for (var i = 0; i < statusArrs.length; i++) {
                            if (statusArrs[i].checked) {
                                //以:作为分隔,方便后台遍历
                                statuss += statusArrs[i].value + ":";
                            }
                        }
                        var hiddenstatus = document.getElementById("__multiselect_search_statusArr");
                        hiddenstatus.value = statuss;


                        document.getElementById("pageNumber").value = 1;
                        document.myForm.submit();


                    }
                </script>

                <div class="main">
                    <div class="content">
                        <div class="pageHead">
                            <table>
                                <tr>
                                    <th width="8"><img src="${path}/images/c_l.gif" height="31"
                                                       width="8"/></th>
                                    <th align="left" class="title_area">当前位置：客户管理 &gt; 拜访查询</th>
                                    <th width="9"><img src="${path}/images/c_r.gif" height="31"
                                                       width="9"></th>
                                </tr>
                            </table>
                        </div>
                        <div class="pageBody">
                            <form id="search" name="myForm" action='${path}/visitRecord/search' method="post"
                                  autocomplete="off">
                                <input type="hidden" name="pager.pageNumber" value="1" id="pageNumber"/>
                                <table class="mytable fullWidth">
                                    <tr>
                                        <th>拜访方式</th>
                                        <td>
                                            <c:if test="${!empty typeList}">
                                                <c:forEach items="${typeList}" var="tl">
                                                    <c:if test="${visitTypeIDs.contains(tl.id)}" var="flag">
                                                        <input type="checkbox" name="visitTypeArr" value="${tl.id}"
                                                               id="${tl.id}" checked/>
                                                        <label for="${tl.id}" class="checkboxLabel">${tl.name}</label>
                                                    </c:if>
                                                    <c:if test="${!flag}">
                                                        <input type="checkbox" name="visitTypeArr" value="${tl.id}"
                                                               id="${tl.id}"/>
                                                        <label for="${tl.id}" class="checkboxLabel">${tl.name}</label>
                                                    </c:if>
                                                </c:forEach>
                                            </c:if>


                                            <input type="hidden" id="__multiselect_search_visitTypeArr"
                                                   name="__multiselect_visitTypeArr"
                                                   value=""/></td>
                                    </tr>
                                    <tr>
                                        <th>仅第一次拜访</th>

                                        <td>
                                            <input type="checkbox" name="onlyFirstVisit" value="true"
                                                   id="search_onlyFirstVisit"
                                                   <c:if test="${onlyFirstVisitStr}">checked</c:if>/>


                                            <input type="hidden"
                                                   id="__checkbox_search_onlyFirstVisit"
                                                   name="__checkbox_onlyFirstVisit"
                                                   value="true"/></td>
                                    </tr>
                                    <tr>
                                        <th>客户等级</th>
                                        <td>

                                            <input type="checkbox" name="levelArr" value="ONE"
                                                   id="levelArr-1"
                                                   <c:if test="${levels.contains('ONE')}">checked</c:if>/>
                                            <label for="levelArr-1" class="checkboxLabel">★</label>

                                            <input type="checkbox" name="levelArr" value="TWO"
                                                   id="levelArr-2"
                                                   <c:if test="${levels.contains('TWO')}">checked</c:if>/>
                                            <label for="levelArr-2" class="checkboxLabel">★★</label>

                                            <input type="checkbox" name="levelArr" value="THREE"
                                                   id="levelArr-3"
                                                   <c:if test="${levels.contains('THREE')}">checked</c:if>/>
                                            <label for="levelArr-3" class="checkboxLabel">★★★</label>

                                            <input type="checkbox" name="levelArr" value="FOUR"
                                                   id="levelArr-4"
                                                   <c:if test="${levels.contains('FOUR')}">checked</c:if>/>
                                            <label for="levelArr-4" class="checkboxLabel">★★★★</label>

                                            <input type="checkbox" name="levelArr" value="FIVE"
                                                   id="levelArr-5"
                                                   <c:if test="${levels.contains('FIVE')}">checked</c:if>/>
                                            <label for="levelArr-5" class="checkboxLabel">★★★★★</label>

                                            <input type="hidden" id="__multiselect_search_levelArr"
                                                   name="__multiselect_levelArr"
                                                   value=""/></td>
                                    </tr>


                                    <tr>
                                        <th><a id="chooseOwner" href="#">选择客户专员</a></th>
                                        <td><input type="hidden" name="owners" value="" id="ownerInputId"/>
                                            <input type="text" name="ownersName"
                                                   value="${ownersName}" readonly="readonly" id="ownerInput"/></td>
                                    </tr>


                                    <tr>
                                        <th>客户的状态</th>
                                        <td><input type="checkbox" name="statusArr" value="SIGNED"
                                                   id="statusArr-1"
                                                   <c:if test="${statuss.contains('SIGNED')}">checked</c:if>/>
                                            <label for="statusArr-1" class="checkboxLabel">服务中签约客户</label>

                                            <input type="checkbox" name="statusArr" value="UNSIGNED"
                                                   id="statusArr-2"
                                                   <c:if test="${statuss.contains('UNSIGNED')}">checked</c:if>/>
                                            <label for="statusArr-2" class="checkboxLabel">未签约客户</label>

                                            <input type="checkbox" name="statusArr" value="SEA"
                                                   id="statusArr-3"
                                                   <c:if test="${statuss.contains('SEA')}">checked</c:if>/>
                                            <label for="statusArr-3" class="checkboxLabel">公海客户</label>

                                            <input type="checkbox" name="statusArr" value="UNSIGNED_YICHUSHI"
                                                   id="statusArr-4"
                                                   <c:if test="${statuss.contains('UNSIGNED_YICHUSHI')}">checked</c:if>/>
                                            <label for="statusArr-4" class="checkboxLabel">已初试</label>

                                            <input type="checkbox" name="statusArr" value="UNSIGNED_YIFUSHI"
                                                   id="statusArr-5"
                                                   <c:if test="${statuss.contains('UNSIGNED_YIFUSHI')}">checked</c:if>/>
                                            <label for="statusArr-5" class="checkboxLabel">已复试</label>

                                            <input type="checkbox" name="statusArr" value="SIGNED_LEAVE"
                                                   id="statusArr-6"
                                                   <c:if test="${statuss.contains('SIGNED_LEAVE')}">checked</c:if>/>
                                            <label for="statusArr-6" class="checkboxLabel">已离开</label>

                                            <input type="hidden" id="__multiselect_search_statusArr"
                                                   name="__multiselect_statusArr"
                                                   value=""/></td>
                                    </tr>


                                    <tr>
                                        <td colspan="4">
                                            <div class="buttonBar">
                                                <button id="btnSearch" onclick="submitForm()">查询</button>
                                                <button id="btnReset" type="reset">重置</button>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </form>


                            <div class="pageBody">

                                <div style="height:30"></div>
                                <table class="mytable resultTable fullWidth">
                                    <tr>
                                        <th style="width: 50px">序号</th>
                                        <th>拜访日期</th>
                                        <th>成熟度</th>
                                        <th>拜访内容</th>
                                        <th>客户专员</th>
                                        <th>拜访方式</th>
                                        <th>客户联系人</th>
                                        <th>客户的状态</th>
                                    </tr>


                                    <c:if test='${ empty recordPager.list}'>
                                        <tr>
                                            <td colspan='7'>暂无数据</td>
                                        </tr>
                                    </c:if>

                                    <c:if test='${!empty recordPager.list}'>
                                        <c:forEach items='${recordPager.list}' var='rp' varStatus="rpStatus">
                                            <tr>
                                                <td>${rpStatus.count}</td>
                                                <td>${rp.visitDate}</td>
                                                <td>${rp.level}</td>
                                                <td>${rp.content}</td>
                                                <td>${rp.owner.realName}</td>
                                                <td>${rp.visitType.name}</td>
                                                <td>${rp.contact.name}</td>
                                                <td>${rp.status}</td>
                                            </tr>
                                        </c:forEach>

                                    </c:if>
                                </table>
                            </div>


                            <div class="pager-container">


                                <script type="text/javascript">
                                    function pager(num) {
//        alert("num:"+num);
                                        document.getElementById("pageNumber").value = num;
                                        document.myForm.submit();
                                    }
                                </script>


                                <ul class="pager">
                                    <li class="pageInfo">共${recordPager.totalCount}条记录,
                                    <li class="pageInfo">共${recordPager.pageCount}页，当前为第${recordPager.pageNumber}页</li>
                                    <!--首页-->


                                    <li class="firstPage">
                                        <span><a href="${path}/visitRecord/search?pageNumber=1">首页</a></span>
                                    </li>

                                    <!--上一页-->
                                    <c:if test="${recordPager.pageNumber!=1 }">
                                        <li class="prePage">
                                            <span><a
                                                    href="${path}/visitRecord/search?pageNumber=${pageBean.pageNumber-1}">上一页</a></span>
                                        </li>
                                    </c:if>

                                    <c:if test="${recordPager.pageNumber==1 }">
                                        <li class="disabled">
                                            <span><a>上一页</a></span>
                                        </li>
                                    </c:if>


                                    <!--下一页-->
                                    <c:if test="${recordPager.pageNumber!=recordPager.pageCount }">
                                        <li class="nextPage">
                                            <span><a
                                                    href="${path}/visitRecord/search?pageNumber=${recordPager.pageNumber+1}">下一页</a></span>
                                        </li>
                                    </c:if>

                                    <c:if test="${recordPager.pageNumber==recordPager.pageCount }">
                                        <li class="disabled">
                                            <span><a>下一页</a></span>
                                        </li>
                                    </c:if>


                                    <!--末页-->
                                    <li class="lastPage">
                                        <span><a href="${path}/visitRecord/search?pageNumber=${recordPager.pageCount}">尾页</a></span>
                                    </li>

                                </ul>
                            </div>

                        </div>
                    </div>
                </div>

            </div>
        </td>
    </tr>
</table>

<!--尾部-->
<div class="footer">


    <div class="seperator"></div>
    <p>
        <a href="http://www.sztzedu.com">公司主站</a>|
        <a href="#">隐私策略</a>|
        <a href="#">服务条款</a>&nbsp;
        苏州天智教育公司&reg;版权所有 2012-2015
    </p>

</div>
</body>
</html>